import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2023-11-07
 * Time: 15:56
 */
public class Test {
    public static  int [] fib(int n) {
        if(n <= 0) {
            return null;
        }
        int [] array = new int [n];
        array[0] = array[1] = 1;
        for (int i = 2; i <n ; i++) {
            array[i] = array[i-1]+array[i-2];
        }
        return array;
    }
    public static void main(String[] args) {
         int [] array = fib(10);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
    }
    public static void fun2(int [] array) {
        array = new int [] {11,22,33,44,55};
    }
    public static void main9(String[] args) {
        int [] array = {1,2,3,4,5};
        fun2(array);
        System.out.println(Arrays.toString(array));
    }
    public static void fun1(int [] array) {
        array[2]=100;
    }
    public static void main8(String[] args) {
        int [] array = {1,2,3,4,5};
        fun1(array);
        System.out.println(Arrays.toString(array));
    }
    public static void fun(int n) {
        n=10;
        System.out.println("n="+n);
    }
    public static void main7(String[] args) {
        int num = 0;
        fun(num);
        System.out.println("num="+num);
    }
    public static void main6(String[] args) {
        int [] array = null;
        System.out.println(array[0]);
    }
    public static void main5(String[] args) {
        int [] array = {1,2,3,4,5,6};
        for (int x:array) {
            System.out.print(x+" ");
        }
    }
    public static void main4(String[] args) {
        int [] array = {1,2,3,4,5};
        //通过输出一个一个的输出。
        System.out.print(array[0]+" ");
        System.out.print(array[1]+" ");
        System.out.print(array[2]+" ");
        System.out.print(array[3]+" ");
        System.out.println(array[4]+" ");
        //通过循环将数组中的内容一一打印出来
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
        System.out.println();
        //通过Arrays类中的toString()方法来打印（将数组的内容转化为字符串再输出）
        System.out.println(Arrays.toString(array));
    }
    public static void main3(String[] args) {
        int [] array = {1,2,3};
        System.out.println(array[3]);
    }
    public static void main2(String[] args) {
        String [] str = new String[5];
    }
    public static void main1(String[] args) {
        int [] array = new int[5];
        boolean [] boo = new boolean[5];
    }
}
